# ppt 增加图片

from pptx import Presentation
from pptx.util import Pt

def add_pic():
    ppt = Presentation()

    slide = ppt.slides.add_slide(ppt.slide_layouts[1])
    # 获取内容框
    shapes = slide.shapes
    left = top = Pt(30)
    shapes.add_picture('../02.py_pptFile/bak2.jpg', left, top)

    slide2 = ppt.slides.add_slide(ppt.slide_layouts[1])
    # 获取内容框
    shapes = slide2.shapes
    left = top = Pt(3)
    height = Pt(300)
    shapes.add_picture('../02.py_pptFile/bak2.jpg', left, top, height)
    ppt.save('../02.py_pptFile/02.ppt增加图片.pptx')


if __name__ == '__main__':
    add_pic()